import api from '../http'
import {
  UserQuery,
  EmployeeModel,
  QueryListModel,
} from '@/api/User/model/loginModel'

//登录
export const login = (data: any) => {
  return api({
    url: '/employee/login',
    method: 'POST',
    data,
  })
}

//退出登录
export const logout = () => {
  return api({
    url: '/employee/logout',
    method: 'GET',
  })
}

//用户列表
export const apiUserList = (params: UserQuery) => {
  return api({
    url: '/employee/list',
    method: 'GET',
    params,
  })
}

// 删除用户
export const apiDelete = (empId: number) => {
  return api({
    url: `/employee/delete/${empId}`,
    method: 'DELETE',
  })
}

//新增用户
export const apiAdd = (data: EmployeeModel) => {
  return api({
    url: '/employee/addEmployee',
    method: 'POST',
    data,
  })
}

//修改用户
export const apiUpdate = (data: EmployeeModel) => {
  return api({
    url: '/employee/update',
    method: 'PUT',
    data,
  })
}

//查询用户
export const apiQueryUser = (empId: number) => {
  return api({
    url: `/employee/query/${empId}`,
    method: 'GET',
  })
}

//模糊查询用户列表
export const apiQueryList = (params: QueryListModel) => {
  return api({
    url: `/employee/queryList`,
    method: 'GET',
    params,
  })
}

//修改密码
export const apiChangePassWord = (data: any) => {
  return api({
    url: `/employee/changePassword`,
    method: 'POST',
    data,
  })
}

//添加排班
export const apiAddScheduling = (data: any) => {
  return api({
    url: `/scheduling/add`,
    method: 'POST',
    data,
  })
}

//获取某个医生的
export const apiGetInfo = (empId: number) => {
  return api({
    url: `/scheduling/info`,
    method: 'GET',
    params: {
      empId,
    },
  })
}

//清除一个医生的排班
export const apiDeleteScheduling = (id: number) => {
  return api({
    url: `/scheduling/delete/${id}`,
    method: 'DELETE',
  })
}

//获取用户占比
export const apiGetUserRatio = () => {
  return api({
    url: `/employee/ratio`,
    method: 'GET',
  })
}

//获取首页信息
export const apiGetHomeInfo = () => {
  return api({
    url: `/employee/homeInfo`,
    method: 'GET',
  })
}
